package com.ebo.synframework.synroom.executor;

import java.util.concurrent.atomic.AtomicInteger;

import com.ebo.synframework.synroom.executor.pool.PoolState;

public class TakeTurnsPoolSelector implements ThreadPoolSelector {
    
    private PoolState[] pools;
    
    private final AtomicInteger poolIndex = new AtomicInteger();
    
    @Override
    public void setPoolsState(PoolState[] pools) {
        this.pools = pools;
    }

    @Override
    public int selectPool() {
        return poolIndex.getAndIncrement() % this.pools.length;
    }

}
